/*
Java source file
Copyright: Umschalt.com 2012
*/
package com.david.documentation.service.link;

import com.david.documentation.domain.dao.link.LinkDao;
import com.david.documentation.domain.entities.link.Link;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service(value = "linkService")
@Transactional(rollbackFor = Exception.class)
public class LinkServiceImpl implements LinkService {

	@Autowired
	private LinkDao linkDao;

	public boolean checkforDublicate(String link) {
		return linkDao.checkforDublicate(link);
	}

	public Link findById(Long id) {
		return linkDao.findById(id);
	}

	public void save(Link link) {
		linkDao.merge(link);
	}

	public Link update(Link link) {
		return linkDao.merge(link);
	}

	public void remove(Link link) {
		linkDao.removeSafely(link);
	}

	public long size() {
		return linkDao.size();
	}

	public List<Link> findAll() {
		return linkDao.findAll();
	}
}
